﻿using System.Text;
using System.Web;
using TallComponents.Web.Pdf;
using TallComponents.Web.Storage;

namespace TallComponents.Web
{
   public partial class WebForm1 : System.Web.UI.Page
   {
      protected void uploadPdf_Click( object sender, System.EventArgs e )
      {
         HttpPostedFile postedFile = Request.Files[ "pdf" ];
         if ( null != postedFile )
         {
            string key = PdfStorage.Provider.StoreFile( postedFile );

            pdfViewer.StorageKey = key;
            //pdfViewer.PageIndex = 0;
         }
      }

      protected override void OnPreRender( System.EventArgs e )
      {
         buttonFind.OnClientClick = string.Format( "$find('{0}').search($get('{1}').value, $get('{2}').checked, $get('{3}').checked);return false;", pdfViewer.ID, TextFind.ClientID, checkMatchCase.ClientID, checkMatchWord.ClientID );
         buttonCancel.Attributes[ "onclick" ] = string.Format( "$find('{0}').cancelSearch();return false;", pdfViewer.ID );
         base.OnPreRender( e );
      }
   }
}
